package com.itheima.dao;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface UserDao {


    @Select("select id,username,password,name from user")
    public List<User> findUsers();

    @Select("select id,username,password,name from user where id = #{userId}")
    public User getUser(@Param("userId") Long id);

    @Insert("insert into user(id,username,password)values (#{id},#{username},#{password})")
    public int saveUser(User user);

    @Update("UPDATE user SET username=#{username},password=#{password} where id = #{id}")
    public int updateUser(User user);

    @Delete("DELETE FROM user where id = #{userId}")
    public int deleteById(@Param("userId") Long id);

}
